import java.io.*;
import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入要复制的文件(绝对路径/相对路径)：");
        String sourcePath = sc.next();
        File file = new File(sourcePath);

        if(!file.exists()){
            return;
        }

        System.out.println("请输入要复制到的路径：");
        String destPath = sc.next();

        InputStream is = new FileInputStream(sourcePath);
        OutputStream os = new FileOutputStream(destPath);

        while(true){
            int n = is.read();
            if(n == -1){
                return;
            }
            os.write(n);
        }

        is.close();
        os.close();
    }
}
